/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package simulateur;

import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;

/**
 *
 * @author mamhanneche
 */
public class Main {

    /**
     * @param args the command line arguments
     *
     */
    
    
    public static void main(String[] args) {
        // TODO code application logic here
        
        PrintWriter out;
        
        try
        {
             ServerSocket serveur = new ServerSocket(5000);
             System.out.println("Attente de connexion sur le port 5000");
             Socket socketduserveur = serveur.accept();
             System.out.println("Connexion établie");
             out = new PrintWriter(socketduserveur.getOutputStream());
             
             System.out.println("Envoie trame temperature");
             out.print("A55A0B07000078080089337800C6");
             Thread.sleep(3000);
             out.flush();

             System.out.println("Envoie trame contact1 ferme");
             out.print("A55A0B06000000090001B5920062");
             Thread.sleep(3000);
             out.flush();

             System.out.println("Envoie trame contact1 ouvert");
             out.print("A55A0B06000000080001B5920061");
             Thread.sleep(3000);
             out.flush();

             System.out.println("Envoie trame contact2 fermé");
             out.print("A55A0B06000000090001B25E002B");
             Thread.sleep(3000);
             out.flush();

             System.out.println("Envoie trame contact2 ouvert");
             out.print("A55A0B06000000080001B25E002A");
             Thread.sleep(3000);
             out.flush();

             System.out.println("Envoie trame Luminosité présent");
             out.print("A55A0B072008018500054A7F008E");
             Thread.sleep(3000);
             out.flush();

             System.out.println("Envoie trame Luminosité absence");
             out.print("A55A0B07CA36000F00054A7F00EF");
             Thread.sleep(3000);
             out.flush();

             System.out.println("Envoie trame interrupteur ");
             out.print("A55A6B050000000FF9F1E0630006");
             Thread.sleep(3000);
             out.flush();


             socketduserveur.close();

        }
        catch (Exception e)
                {
                e.printStackTrace();
                }
        
    }

}
